package com.yc.testupload.crawler.config;

import java.util.Map;

/**
 * 频道配置类
 * 存储单个频道的配置信息，包括频道名称、对应的文库分类ID、抓取正则表达式等
 */
public class ChannelConfig {
    private String id; // 频道ID
    private String name; // 频道名称
    private int categoryId; // 对应的文库分类ID
    private Map<String, String> regexPatterns; // 抓取相关的正则表达式配置

    // 构造函数
    public ChannelConfig(String id, String name, int categoryId, Map<String, String> regexPatterns) {
        this.id = id;
        this.name = name;
        this.categoryId = categoryId;
        this.regexPatterns = regexPatterns;
    }

    // getter和setter
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public Map<String, String> getRegexPatterns() {
        return regexPatterns;
    }

    public void setRegexPatterns(Map<String, String> regexPatterns) {
        this.regexPatterns = regexPatterns;
    }

    /**
     * 根据名称获取正则表达式模式
     */
    public String getRegexPattern(String patternName) {
        return regexPatterns.get(patternName);
    }
}